<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/1/9
 * Time: 16:26
 */
namespace app\common\model;


use think\Model;

class Purchase extends Model{


    /**
     * 增加采购需求
     */
    public function purchase_add($goods_name='',$goods_num=0,$waiting_storage=0,$already_storage=0,$shop,$total=0,$tb_id=0,$is_tmall=0,$url='',$img_url='',$residual_task=1,$cat_id=16,$couponurl='',$price=0){
        $data['goods_name'] = $goods_name;
        $data['goods_num'] = $goods_num;
        $data['waiting_storage'] = $waiting_storage;
        $data['already_storage'] = $already_storage;
        $data['shop'] = trim($shop);
        $data['total'] = trim($total);
        $data['tb_id'] = trim($tb_id);
        $data['is_tmall'] = $is_tmall;
        $data['url'] = $url;
        $data['img_url'] = $img_url;
        $data['residual_task'] = $residual_task;
        $data['cat_id'] = $cat_id;
        $data['add_time'] = time();
        $data['update_time'] = time();
        $data['price'] = $price;
        $data['couponurl'] = $couponurl;
        $purchase_id = self::insertGetId($data);
        if ($purchase_id){
            return $purchase_id;
        }else{
            return false;
        }
    }

}